// app/utils/password.js
const bcrypt = require("bcrypt");

module.exports = {
  // 生成哈希密码
  async hash(password) {
    const saltRounds = 10; // 计算强度，值越高越安全但越慢
    return await bcrypt.hash(password, saltRounds);
  },

  // 验证密码
  async compare(password, hash) {
    return await bcrypt.compare(password, hash);
  },
};
